<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>业务功能首页</title>
<link rel="stylesheet" href="<%=path%>/css/bootstrap.min.css" />
<link rel="stylesheet" href="<%=path%>/css/easyui.css" />
<link rel="stylesheet" href="<%=path%>/css/icon.css" />
<style>
body {
	background-color: #f1f1f1;
}

.lightBg {
	background-color: #fff;
	padding: 5px 20px;
}
</style>
</head>
<body>

	<div class="container">
		<div class="row lightBg">
			<!--标题-->
			<h2 class="pull-left">
				<img src="<%=path%>/images/logo.png" style="width: 80px;">
				智游科技项目申报系统
			</h2>
			<p class="pull-right" style="margin-top: 20px;">
				欢迎您，政务管理员:${user.UName }&nbsp;|&nbsp;<a href="">站内消息(2)</a>&nbsp;<a
					href="javascript:doOut()">退出</a>
			</p>
		</div>
		<div class="row" style="margin-top: 20px;">
			<!--页面一二级菜单部分，公用的-->
			<div class="easyui-tabs" style="">
				<div title="申报管理" style="padding:10px">
					<div class="easyui-panel" style="padding:5px;">
						<a href="javascript:pro1()" class="easyui-linkbutton"
							data-options="plain:true">审核申请书</a> <a href="javascript:pro2()"
							class="easyui-linkbutton" data-options="plain:true">受理申请书</a> <a
							href="javascript:pro3()" class="easyui-linkbutton"
							data-options="plain:true">所有申请书查询</a>
					</div>
				</div>
				<div title="项目管理" style="padding:10px">
					<div class="easyui-panel" style="padding:5px;">
						请以另一种身份登录，此身份不可用
					</div>
				</div>
				<div title="拨款管理" style="padding:10px">此功能暂不实现</div>
				<div title="系统管理" style="padding:10px" data-options="plain:true">
					<div class="easyui-panel" style="padding:5px;">
						请以另一种身份登录，此身份不可用
					</div>
				</div>
			</div>
		</div>

		<!--页面实际数据管理部分-->
		<div class="row" style="margin-top: 20px;">
			<div style="background-color: #fff;padding: 20px;">
				项目名称：<input type="text" id="pname" value="${pname }" /> 填报时间：<input
					type="text" id="ptime" value="${ptime }" /> 项目类型：<select
					id="ptype">
					<option value="">请选择</option>
					<c:forEach var="p" items="${projects }">
						<option value="${p.PType }">${p.PType }</option>
					</c:forEach>
				</select>
				<button id="seachpro" class="btn btn-primary">查询</button>
			</div>
			<div name="1F" style="background-color: #fff;padding: 20px;">
				<table id="dg" class="easyui-datagrid" title="数据表格示例"
					style="height: 500px;"
					data-options="rownumbers:true,singleSelect:true,url:'getAllProjects',pagination : true,pageSize : 5,pageList : [ 5, 10, 15 ],fitColumns : true,striped : true,method:'get'"
					toolbar="#tb">
					<thead>
						<tr>
							<th width="120px" data-options="field:'pid',align:'center'"
								title="项目编号">项目编号</th>
							<th width="90px" data-options="field:'pname',align:'center'"
								title="项目名">项目名称</th>
							<th width="120px" data-options="field:'ptype',align:'center'"
								title="项目类型">项目类型</th>
							<th width="120px" formatter="company"
								data-options="field:'company',align:'center'" title="申报单位">申报单位</th>
							<th width="120px" data-options="field:'pcompany',align:'center'"
								title="推荐单位">推荐单位</th>
							<th width="120px" formatter="pcontact"
								data-options="field:'pcontact',align:'center'" title="负责人">负责人</th>
							<th width="120px" data-options="field:'ptime',align:'center'"
								title="提交时间">提交时间</th>
							<th width="120px" formatter="pstate"
								data-options="field:'pstate',align:'center'" title="状态">状态</th>
							<th
								data-options="field:'aaa',align:'center',width:180,formatter:aaa">PDF</th>
							<th
								data-options="field:'id',align:'center',width:180,formatter:rowformater">操作</th>
							<th
								data-options="field:'cc',align:'center',width:180,formatter:cc">通知</th>
						</tr>
					</thead>
				</table>
				<div id="tb" style="padding:5px;height:auto">
					<script src="<%=path%>/js/jquery1.12.4.min.js"></script>
					<script src="<%=path%>/js/bootstrap.min.js"></script>
					<script src="<%=path%>/js/jquery.easyui.min.js"></script>
					<script type="text/javascript">
						function pro1() {
							window.location = 'toPro1'
						}
						function pro2() {
							window.location = 'toPro2'
						}
						function pro3() {
							window.location = 'toPro3'
						}
						function company(value, row, index) {
							return value.cname;
						};
						function pcontact(value, row, index) {
							return "<a href='javascript:getUser(" + row.pid
									+ ")'>" + value + "</a>";
						};
						function rowformater(value, row, index) {
							return "<a href='javascript:getPId(" + row.pid
									+ ")' target='_blank'>进入审核</a>";
						};
						function aaa(value, row, index) {
							return "<a href='javascript:findPId(" + row.pid
									+ ")' target='_blank'>导出</a>";
						};
						function cc(value, row, index) {
							return "<a href='javascript:getEmail(" + row.pid
									+ ")' target='_blank'>邮箱通知</a>";
						};

						function pstate(value, row, index) {
							if (value == 1) {
								return "待审核";
							}
							if (value == 2) {
								return "已通过";
							}
						};

						function getUser(PId) {
							window.location = 'getUser?PId=' + PId;
						}
						function getPId(PId) {
							window.location = 'findProject?PId=' + PId;
						}
						function findPId(PId) {
							window.location = 'importPdf?PId=' + PId;
						}
						
						function getEmail(PId) {
							window.location = 'getEmail?PId=' + PId;
						}
						function doOut() {
							window.location = 'news/toIndex2';
						}	
						$(function() {
							$("#seachpro").button().click(function() {
								searchProject();
							});
							$("#dg").datagrid()({
								url : 'getAllProjects'
							});
						});
						function searchProject() {
							var pname = $('#pname').val();
							var ptime = $('#ptime').val();
							var ptype = $('#ptype').val();
							$('#dg').datagrid('load', {
								PName : pname,
								PTime : ptime,
								PType : ptype
							});
						}
						window.onload = searchProject;
					</script>
				</div>
				<span style="color: red;"><%=request.getAttribute("msg") == null ? "" : request
					.getAttribute("msg")%></span>
</body>
</html>